/**
 * 公共方法
 * @author 阿城 <479468212@qq.com>
 */
import config from '@/static/js/config.js'
import apiRequest from '@/static/js/api.request.js'
import { forEach, hasOneOf, objEqual } from '@/static/js/tools.js'

export const TOKEN_KEY = 'easyApi_'

export const setToken = (token) => {
  uni.setStorageSync(TOKEN_KEY + 'LoginToken', token)
}

export const getToken = () => {
  const token = uni.getStorageSync(TOKEN_KEY + 'LoginToken')
  if (token) {
    return token
  } else {
    return false
  }
}

export const getUserInfo = () => {
	const userInfo = uni.getStorageSync(TOKEN_KEY + 'UserInfo')
	if (userInfo) {
	  return userInfo
	} else {
	  return {}
	}
}

export const sleep = (ms) => {
	return new Promise((resolve)=>{
		setTimeout(resolve, ms)
	})
}